<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="f" uri="http://www.itcms.com/tags/form"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Itcms管理平台 - Powered by Itcms</title>
<jsp:include page="/WEB-INF/views/commons/head.jsp"></jsp:include>
<script type="text/javascript" src="${ctx}/static/back/scripts/city.js"></script>
<script type="text/javascript">
$(function() {
	$("#pagedTable").tableHighlight();

	 if($("input[name='status']").eq(0).val() == 1){
		$("#talent").css("color","red");
		$("#talent").val("取消人才");
	}
});
function confirmDelete() {
	return confirm("<s:message code='confirmDelete'/>");
}
function optSingle(opt) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(Cms.checkeds("ids")>1) {
		alert("<s:message code='pleaseSelectOne'/>");
		return false;
	}
	var id = $("input[name='ids']:checkbox:checked").val();
	location.href=$(opt+id).attr("href");
}
function optDelete(form) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(!confirmDelete()) {
		return false;
	}
	form.action='delete.do';
	form.submit();
	return true;
}

function optLogicDelete(form) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(!confirmDelete()) {
		return false;
	}
	form.action='logicDelete.do';
	form.submit();
	return true;
}

function confirmTalent() {
	return confirm("确定执行当前人才操作么？");
}
function optTalent(form) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(!confirmTalent()) {
		return false;
	}
	form.action='talent.do';
	form.submit();
	return true;
}

function confirmExport(form) {
	/* var input = $(form).prev().find('input[type=text]');
	input.each(function(i){
		var text = $(this).val();
		 if(text ==""){
			 return confirm("确定导出全部数据么？");
		 }else{
		}
	});
	var select = $(form).prev().find('select'); */ 
	
	return confirm("请先搜索或选中后再下载，否则会因下载全部数据导致耗时较长！"); 
}
function optExport(form) {
	if(!confirmExport(form)) {
		return false;
	}
	//form.action='export.do';
	form.action='download.do';
	form.submit();
	return true;
}

function returnList(){
	var url = location.search;
	if(url.indexOf("returnType") >= 0){
		history.go(-1);
	}else{
		window.location.href = "list.do";
	}	
}

function downLoad(url){
	alert(url);
	var encodeObj = encodeURI(url);
	url = encodeURI(encodeObj);
	alert(encodeObj);
	alert(decodeURI(encodeObj)); 
	url = decodeURI(encodeObj);
	location.href = url;
}
</script>
</head>
<body class="c-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="c-bar margin-top5">
  <span class="c-position"><s:message code="resume.management"/> - <s:message code="list"/></span>
	<span class="c-total">(<s:message code="totalElements" arguments="${pagedList.totalElements}"/>)</span>
</div>
<form action="list.do" method="get">
	<fieldset class="c-fieldset">
    <legend><s:message code="search"/></legend>
	  <label class="c-lab"><s:message code="resume.name"/>: <input type="text" name="search_CONTAIN_CName" value="${search_CONTAIN_CName[0]}"/></label>
	  <label class="c-lab"><s:message code="resume.post"/>: <input type="text" name="search_CONTAIN_applyJobInfo.CJobname1" value="${requestScope['search_CONTAIN_applyJobInfo.CJobname1'][0]}"/></label>
	  <label class="c-lab"><s:message code="beginDate"/>: <f:text name="search_GTE_applyJobInfo.CApplydate_Date" value="${requestScope['search_GTE_applyJobInfo.CApplydate_Date'][0]}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" style="width:80px;"/></label>
	  <label class="c-lab"><s:message code="endDate"/>: <f:text name="search_LTE_applyJobInfo.CApplydate_Date" value="${requestScope['search_LTE_applyJobInfo.CApplydate_Date'][0]}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" style="width:80px;"/></label>
	 <br /><label class="c-lab">
	  	<select name="search_EQ_applyJobInfo.department.company.CCompanyid" id="company">
	  		<option value="">---选择公司---</option>
	  		<c:forEach var="company" items="${companyList}">
	  		<c:set var="idstr">${company.CCompanyid}</c:set>
	  		<option value="${company.CCompanyid}"<c:if test="${idstr eq requestScope['search_EQ_applyJobInfo.department.company.CCompanyid'][0]}"> selected="selected"</c:if>>${company.CName}</option>
	  		</c:forEach>
  		</select>
	  </label>
	   <label class="c-lab">
	  	<select name="search_EQ_applyJobInfo.department.CDepartmentid" id="department">
	  		<option value="">---选择部门---</option>
	  		<c:forEach var="department" items="${departmentList}">
	  		<c:set var="idstr">${department.CDepartmentid}</c:set>
	  		<option value="${department.CDepartmentid}" parentid="${department.company.CCompanyid}"<c:if test="${idstr eq requestScope['search_EQ_applyJobInfo.department.CDepartmentid'][0]}"> selected="selected"</c:if>>${department.CName}</option>
	  		</c:forEach>
  		</select>
	  </label>
	  <label class="c-lab">
  		<select name="search_EQ_applyJobInfo.recEmployee.CKnowledge">
	  		<option value="">---选择学历---</option>
	  		<option value="1"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '1'}"> selected="selected"</c:if>>研究生</option>
	  		<option value="2"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '2'}"> selected="selected"</c:if>>大学本科</option>
	  		<option value="3"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '3'}"> selected="selected"</c:if>>大专和专科学校</option>
	  		<option value="4"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '4'}"> selected="selected"</c:if>>中专和中技</option>
	  		<option value="5"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '5'}"> selected="selected"</c:if>>技工学校</option>
	  		<option value="6"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '6'}"> selected="selected"</c:if>>高中</option>
	  		<option value="7"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '7'}"> selected="selected"</c:if>>初中</option>
	  		<option value="8"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '8'}"> selected="selected"</c:if>>小学</option>
	  		<option value="9"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CKnowledge'][0] eq '9'}}"> selected="selected"</c:if>>文盲或半文盲</option>
  		</select>
	  </label>
	  <label class="c-lab">状态：
	  	<select name="search_CONTAIN_CStatus">
	  		<option value="">---选择状态---</option>
	  		<option value="1"<c:if test="${requestScope['search_CONTAIN_CStatus'][0] eq '1'}"> selected="selected"</c:if>>人才库</option>
	  		<option value="2"<c:if test="${requestScope['search_CONTAIN_CStatus'][0] eq '2'}"> selected="selected"</c:if>>新投递</option>
	  		<option value="8"<c:if test="${requestScope['search_CONTAIN_CStatus'][0] eq '8'}"> selected="selected"</c:if>>已删除</option>
  		</select>
	  </label> 
	  <label class="c-lab">性别：
  		<select name="search_EQ_applyJobInfo.recEmployee.CSex">
	  		<option value="">---选择性别---</option>
	  		<option value="1"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CSex'][0] eq '1'}"> selected="selected"</c:if>>男</option>
	  		<option value="2"<c:if test="${requestScope['search_EQ_applyJobInfo.recEmployee.CSex'][0] eq '2'}"> selected="selected"</c:if>>女</option>
  		</select>
	  </label>

<%-- 	  <label class="c-lab">站点: <input type="text" name="search_EQ_employeeSite.siteId" value="${requestScope['search_CONTAIN_employeeSite.siteId'][0]}"/></label> --%>
	  <label class="c-lab"><input type="submit" value="<s:message code="search"/>"/></label>
	  <label class="c-lab"><input type="button" value="<s:message code="return"/>" onclick="returnList();"/></label>  
  </fieldset>
</form>
<form method="post">
<tags:search_params/>
<div class="ls-bc-opt">
	<%-- <shiro:hasPermission name="plug:employee:create">
	<div class="ls-btn"><input type="button" value="<s:message code="create"/>" onclick="location.href='create.do?${searchstring}';"/></div>
	<div class="ls-btn"></div>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:employee:copy">
	<div class="ls-btn"><input type="button" value="<s:message code="copy"/>" onclick="return optSingle('#copy_opt_');"/></div>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:employee:edit">
	<div class="ls-btn"><input type="button" value="<s:message code="edit"/>" onclick="return optSingle('#edit_opt_');"/></div>
	</shiro:hasPermission> 
	<shiro:hasPermission name="plug:employee:delete">
	<div class="ls-btn"><input type="button" value="<s:message code="delete"/>" onclick="return optDelete(this.form);"/></div>
	</shiro:hasPermission>--%>
	<shiro:hasPermission name="plug:employee:logicDelete">
		<c:if test="${requestScope['search_CONTAIN_CStatus'][0] != '8'}">
			<div class="ls-btn"><input type="button" value="<s:message code="delete"/>" onclick="return optLogicDelete(this.form);"/></div>
		</c:if>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:employee:talent">
	<div class="ls-btn"><input type="button" id="talent" value="设为人才" onclick="return optTalent(this.form,this);"/></div>
	</shiro:hasPermission> 
	<div class="ls-btn"><input type="button" value="简历下载" onclick="return optExport(this.form);"/></div>
	<div style="clear:both"></div>
</div>
<table id="pagedTable" border="0" cellpadding="0" cellspacing="0" class="ls-tb margin-top5">
  <thead id="sortHead" pagesort="<c:out value='${page_sort[0]}' />" pagedir="${page_sort_dir[0]}" pageurl="list.do?page_sort={0}&page_sort_dir={1}&${searchstringnosort}">
  <tr class="ls_table_th">
    <th width="25"><input type="checkbox" onclick="Cms.check('ids',this.checked);"/></th>
    <th width="150"><s:message code="operate"/></th>
   <%--  <th width="30" class="ls-th-sort"><span class="ls-sort" pagesort="id">ID</span></th> --%>
      <th class="ls-th-sort"><span class="ls-sort" pagesort="post"><s:message code="resume.post"/></span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="name"><s:message code="resume.name"/></span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="gender"><s:message code="resume.gender"/></span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="birthDate"><s:message code="resume.birthDate"/></span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="nativeplace">籍贯</span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="address">通讯地址</span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="mobile"><s:message code="resume.mobile"/></span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="knowledge">最高学历</span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="specialty">专业</span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="creationDate"><s:message code="resume.creationDate"/></span></th>
  </tr>
  </thead>
  <tbody>
  <c:forEach var="bean" varStatus="status" items="${pagedList.content}">
  <tr<shiro:hasPermission name="plug:employee:edit"> <%-- ondblclick="location.href=$('#edit_opt_${bean.id}').attr('href');" --%></shiro:hasPermission>/>
    <input type="hidden" name="status" value="${bean.CStatus}"/>
    <td><input type="checkbox" name="ids" value="${bean.id}"/></td>
    <td align="center">
			<%-- <shiro:hasPermission name="plug:employee:copy">
      <a id="copy_opt_${bean.id}" href="create.do?id=${bean.id}&${searchstring}" class="ls-opt"><s:message code="copy"/></a>
      </shiro:hasPermission>
			<shiro:hasPermission name="plug:employee:edit">
      <a id="edit_opt_${bean.id}" href="edit.do?id=${bean.id}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}" class="ls-opt"><s:message code="edit"/></a>
      </shiro:hasPermission> --%>
<%--       <a id="view_opt_${bean.id}" href="view.do?id=${bean.id}&jobName=${bean.applyJobInfo.CJobname1}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}" class="ls-opt"><s:message code="view"/></a> --%>
	 <%-- <shiro:hasPermission name="plug:employee:delete">
      <a href="delete.do?ids=${bean.id}&${searchstring}" onclick="return confirmDelete();" class="ls-opt"><s:message code="delete"/></a>
      </shiro:hasPermission> --%>
	 <shiro:hasPermission name="plug:employee:logicDelete">
	 	<c:if test="${requestScope['search_CONTAIN_CStatus'][0] != '8'}">
	 		<a href="logicDelete.do?ids=${bean.id}&${searchstring}" onclick="return confirmDelete();" class="ls-opt"><s:message code="delete"/></a>
	 	</c:if>
      </shiro:hasPermission>
     <shiro:hasPermission name="plug:employee:talent">
     	<c:choose>
	     	<c:when test="${bean.CStatus=='2  '}">
	     		<a href="talent.do?ids=${bean.id}&${searchstring}" onclick="return confirmTalent();" class="ls-opt">设为人才</a>
	     	</c:when>
	     	<c:when test="${bean.CStatus=='1  '}">
	     		<a href="talent.do?ids=${bean.id}&${searchstring}" onclick="return confirmTalent();" class="ls-opt" style="color: red;">取消人才</a>
	     	</c:when>
    	</c:choose>
       
	  </shiro:hasPermission>
	 <c:choose>
   		<c:when test="${not empty bean.fileMidden.fileBlob.CPath}">
<%--     		  <a id="down_opt_${bean.id}" href="download.do?path=${bean.fileMidden.fileBlob.CPath}" class="ls-opt">下载</a> --%>
    		  <a id="down_opt_${bean.id}" href="${bean.fileMidden.fileBlob.CPath}" class="ls-opt">下载</a>
   		</c:when>
   		<c:otherwise>下载</c:otherwise>
	</c:choose> 
    </td>
   <%--  <td><c:out value="${bean.id}"/></td> --%>
    <td><c:out value="${bean.applyJobInfo.CJobname1}"/></td>
   <td><a id="view_opt_${bean.id}" href="view.do?id=${bean.id}&jobName=${bean.applyJobInfo.CJobname1}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}" class="ls-opt"><c:out value="${bean.CName}"/></a></td>
<%--     <td><c:out value="${bean.CName}"/></td> --%>
    <td><c:choose><c:when test="${bean.CSex=='1'}"><s:message code="male"/></c:when><c:otherwise><s:message code="female"/></c:otherwise></c:choose></td>
    <td><fmt:formatDate value="${bean.CBirthday}" pattern="yyyy-MM-dd"/></td>
    <td class="nativePlace"><c:out value="${bean.CNativeplace}"/></td>
    <td><c:out value="${bean.empContact.CAddress}"/></td>
           <td><c:out value="${bean.empContact.CMobile}"/></td>
<%--     <td align="center"><fmt:formatDate value="${bean.creationDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td> --%>
<%--     <td><c:out value="${bean.post}"/></td> --%>
    <td>
    	 <c:choose>
		    	<c:when test="${bean.CKnowledge=='1'}"><c:out value="研究生"/></c:when>
		    	<c:when test="${bean.CKnowledge=='2'}"><c:out value="大学本科"/></c:when>
		    	<c:when test="${bean.CKnowledge=='3'}"><c:out value="大专和专科学校"/></c:when>
		    	<c:when test="${bean.CKnowledge=='4'}"><c:out value="中专和中技"/></c:when>
		    	<c:when test="${bean.CKnowledge=='5'}"><c:out value="技工学校"/></c:when>
		    	<c:when test="${bean.CKnowledge=='6'}"><c:out value="高中"/></c:when>
		    	<c:when test="${bean.CKnowledge=='7'}"><c:out value="初中"/></c:when>
		    	<c:when test="${bean.CKnowledge=='8'}"><c:out value="小学"/></c:when>
		    	<c:when test="${bean.CKnowledge=='9'}"><c:out value="文盲或半文盲"/></c:when>
		    </c:choose>
    </td>
    <td><c:out value="${bean.CSpecialty}"/></td>
    <td align="center"><fmt:formatDate value="${bean.applyJobInfo.CApplydate}" pattern="yyyy-MM-dd"/></td>
  </tr>
  </c:forEach>
  </tbody>
</table>
<c:if test="${fn:length(pagedList.content) le 0}"> 
<div class="ls-norecord margin-top5"><s:message code="recordNotFound"/></div>
</c:if>
</form>
<form action="list.do" method="get" class="ls-page">
	<tags:search_params excludePage="true"/>
  <tags:pagination pagedList="${pagedList}"/>
</form>
</body>
</html>